]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
pokit-agent: fix segfault when we we fail to get the current session
authorMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Fri, 17 Feb 2012 19:48:25 +0000 (20:48 +0100)
committerMarc-Antoine Perennou <Marc-Antoine@Perennou.com>
Sat, 18 Feb 2012 19:27:39 +0000 (20:27 +0100)
When using systemd, polkit doesn't set the error even when returning false in g_initable_init

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
https://bugzilla.gnome.org/show_bug.cgi?id=670319

src/shell-polkit-authentication-agent.c

index ede4fd97b726411cd7ba04c65561d45f8ba00480..472dea51baaf650f9f49eca58190d7253e595cd2 100644 (file)
@@ -108,11 +108,18 @@ shell_polkit_authentication_agent_init (ShellPolkitAuthenticationAgent *agent)
                                                       &error);
   if (subject == NULL)
     {
-      g_warning ("Error getting session for the process we are in: %s (%s %d)",
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
-      g_error_free (error);
+      if (error) /* polkit version 104 and older don't properly set error on failure */
+        {
+          g_warning ("Error getting session for the process we are in: %s (%s %d)",
+                     error->message,
+                     g_quark_to_string (error->domain),
+                     error->code);
+          g_error_free (error);
+        }
+      else
+        {
+          g_warning ("Error getting session for the process we are in");
+        }
       goto out;
     }